package logic

import (
	"context"
	"github.com/zeromicro/go-zero/core/logx"
	"homepage_srv/homepage"
	"homepage_srv/internal/dao"
	"homepage_srv/internal/svc"
)

type AdvertisementPopUpWindowLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewAdvertisementPopUpWindowLogic(ctx context.Context, svcCtx *svc.ServiceContext) *AdvertisementPopUpWindowLogic {
	return &AdvertisementPopUpWindowLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

func (l *AdvertisementPopUpWindowLogic) AdvertisementPopUpWindow(in *homepage.AdvertisementPopUpWindowRequest) (*homepage.AdvertisementPopUpWindowResponse, error) {
	albums, _ := dao.AdvertisementPopUpWindow() //广告弹窗
	return &homepage.AdvertisementPopUpWindowResponse{
		Id:       int64(albums.Id),
		Title:    albums.Title,
		ImageUrl: albums.ImageUrl,
	}, nil
}
